package cn.edu.sdjzu.xg2103.entity;

public class Teacher implements Comparable<Teacher> {
    private Integer id;
    private String name;
    private  String no;
    private Department department;
    private int department_id ;
    public Teacher(Integer id, String name, String no, Department department , int department_id) {
        this.department = department;
        this.id = id;
        this.name = name;
        this.no = no;
        this.department_id = department_id;
    }
    public int compareTo(Teacher o) {
        //this当前对象 与 o 比较
        //返回数据有三种类型：
        //整数 ： 代表this当前对象较大
        //0   :  代表一样大
        //负数 ： 代表this当前对象较小
            if (this.id != null) {
                if (this.id > o.id) {
                    return 1;
                } else if (this.id == o.id) {
                    return 0;
                }
            }
        return -1;
    }
    @Override
    public String toString() {
        return "Teacher{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", no='" + no + '\'' +
                '}';
    }
    public Integer getId() {
        return id;
    }
    public String getName() {
        return name;
    }
    public String getNo() {
        return no;
    }
    public int getDepartment_id() {
        return department_id;
    }
    public Department getDepartment() {
        return department;
    }
}
